import {createRouter,createWebHashHistory} from 'vue-router'

const Home = ()=> import("@/views/Home.vue")
const Cart = () => import("@/views/Cart.vue")
const Detail = () => import("@/views/Detail.vue")
const Login = () => import("@/views/Login.vue")
const My = () => import("@/views/My.vue")
const Register = () => import("@/views/Register.vue")

const routes = [
    {
      path: '/',
      redirect: '/home'
    },
    {
      path: '/home',
      name: 'Home',
      component: Home
    },
    {
      path: '/cart',
      name: 'Cart',
      component: Cart
    },
    {
      path: '/detail',
      name: 'Detail',
      component: Detail
    },
    {
      path: '/login',
      name: 'Login',
      component: Login
    },
    {
      path: '/my',
      name: 'My',
      component: My
    },
    {
      path: '/register',
      name: 'Register',
      component: Register
    },
  ]
  

//创建实例化router对象
const router = createRouter({
    history:createWebHashHistory(),
    routes
})

export default router